package faircat.android.exphone;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.content.Intent;

public class SMS extends ListActivity {
	/*
	private String[] mString={
			getResources().getString(R.string.write_sms),
			getResources().getString(R.string.read_sms)
	};*/
	private ListAdapter buildListAdapter() {
		List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		HashMap<String, String> m1 = new HashMap<String, String>();
		m1.put("user_name", getResources().getString(R.string.write_sms));
		//m1.put("user_gender", "Ů");

		HashMap<String, String> m2 = new HashMap<String, String>();
		m2.put("user_name", getResources().getString(R.string.read_sms));
		//m2.put("user_gender", "Ů");

		list.add(m1);
		list.add(m2);


		SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,
				R.layout.item, new String[] { "user_name" },
				new int[] { R.id.user_name});
		return simpleAdapter;
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sms11);
		ListView mListview = getListView();

		mListview.setAdapter(buildListAdapter());
		mListview.setOnItemClickListener(new OnItemClickListener(){

			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				int position=arg2;
				int mSMcard=1;
				Intent i;
				//startActivity(i);
				// TODO Auto-generated method stub
		    	Log.d("asdfasdasfsd", "arg2="+arg2);
		    	switch(position)
		    	{
		    	case 0:
		    		i=new Intent();
					//i = new Intent(this, NewSMSActivity.class);
					i.setClass(SMS.this, NewSMSActivity.class);

					//i.putExtra("sim", mSimCard);
					startActivity(i);

		    		
		    		
					//  i = new Intent(Intent.ACTION_VIEW); 
					//  i.setType("vnd.android-dir/mms-sms"); 
					//  startActivity(i);  
					break;
		    	case 1:
		    		i=new Intent();
					i.setClass(SMS.this, SMSActivity.class);
					//i.putExtra("sim", mSMcard);
					startActivity(i);
					break;	
		    	}

			}
			
		});
	}

}
